package com.xcity.game.buff.effect;

import com.xcity.db.entity.Player;
import com.xcity.game.buff.Buff;
import com.xcity.game.buff.BuffEffector;
import com.xcity.game.common.Cause;

/**
 * 立即完成建造
 * @author yang.li
 *
 */
public class FinishBuildAtOnceEffect implements BuffEffector {

	@Override
	public boolean effect(Buff buff, Player player) {
		if (!player.isOnline()) {
			return false;
		}
		boolean succ = ((Player) player).getBuildings().forceCompleteBuild(Cause.BUFF);
		if (succ) {
			buff.addUsedTimes(1);
		}
		return succ;
	}

	@Override
	public boolean uneffect(Buff buff, Player player) {
		return true;
	}

}
